package com.icss.train_sys_back.entity;


import lombok.Data;

/**
 * @author wk
 * @desc
 * @date 2025/9/11 10:07
 */
@Data
public class ResponseResult<T> {
    private int code;
    private String message;
    private T data;

    public ResponseResult(T data){
        this.code=ResultEnum.SUCCESS.getCode();
        this.message=ResultEnum.SUCCESS.getMessage();
        this.data=data;
    }

    public ResponseResult(int code,String message){
        this.code=code;
        this.message=message;
    }

    public static <T> ResponseResult<T> success(T data){
        return new ResponseResult<>(data);
    }

    public static <T> ResponseResult<T> success(){
        return new ResponseResult<>(null);
    }

    public static <T> ResponseResult<T> fail(ResultEnum resultEnum){
        return new ResponseResult<>(resultEnum.getCode(),resultEnum.getMessage());
    }


}
